import Vue from 'vue'
import Router from 'vue-router'
import Index from '../pages'
import Dashboard from '../pages/dashboard'
import Page404 from '@/Page404'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      redirect: '/dashboard',
      component: Index,
      children: [
        {
          path: '/dashboard',
          name: 'dashboard',
          component: Dashboard
        },
        {
          path: '/example/simple',
          name: 'simple',
          component: (resolve) => require(['../pages/examples/simple'], resolve)
        },
        {
          path: '/example/detail',
          name: 'exampleDetail',
          component: (resolve) => require(['../pages/examples/detail'], resolve)
        },
        {
          path: '/example/more/search',
          name: 'moreSearch',
          component: (resolve) => require(['../pages/examples/moreSearch'], resolve)
        },
        {
          path: '/example/more/action',
          name: 'moreAction',
          component: (resolve) => require(['../pages/examples/moreAction'], resolve)
        }
      ]
    },
    {
      path: '/error',
      name: 'page404',
      component: Page404
    },
    {
      path: '*',
      redirect: '/error'
    }
  ]
})
